//
//  CertificationShopViewController.m
//  MangoShangJia
//
//  Created by Macbook on 31/7/17.
//  Copyright © 2017年 dazhou. All rights reserved.
//

#import "CertificationShopViewController.h"
#import "HuYuSealed.h"
#import "PickViewController.h"
#define HEXRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define WIDTH [UIScreen mainScreen].bounds.size.width/375
#define HEIGHT [UIScreen mainScreen].bounds.size.height/667
#define UIScreen_WIDTH [UIScreen mainScreen].bounds.size.width
#define UIScreen_HEIGHT [UIScreen mainScreen].bounds.size.height
@interface CertificationShopViewController ()<UITextFieldDelegate>
{
    
    UIView* WhiteViewOne;
    UIView* WhiteViewTow;
    UIButton* PerSonBut;//个人按钮
    UILabel* PerSonLab;
    UIButton* ShopBut;//商家按钮
    UILabel* ShopLab;
    
    //商家认证
    UIView* ShopView;
    UITextField* XuKeNameFiled;//许可证姓名
    UITextField* XuKeHaoFiled;//许可证注册号码
    UITextField* XuKePerFiled;//许可证法人
    UIButton* ShopShenHeBut;//审核按钮
    
    //个人认证
    UIView* PerSonView;
    UITextField* ShenfenPerFiled;//省份证号码
    UIButton* PerShenHeBut;
    
    UIButton *pick;
    
}
@property (nonatomic, strong) NSString * personImageUrl;
@end

@implementation CertificationShopViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"安全认证";
    UIButton *backbutton = [[UIButton alloc]initWithFrame:CGRectMake(10, 20, 15, 25)];
    [backbutton setBackgroundImage:[UIImage imageNamed:@"香草园地-发布信息_03@2x"] forState:UIControlStateNormal];
    [backbutton addTarget:self action:@selector(goBacktoUp) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithCustomView:backbutton];
    self.navigationItem.leftBarButtonItem = backItem;
    self.view.backgroundColor = [UIColor whiteColor];

    [self createPerUI];
}
-(void)goBacktoUp{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)createPerUI
{
    //================== 商家认证====================//
    ShopView = [HuYuSealed createViewFrame:CGRectMake(0, WhiteViewOne.frame.size.height, UIScreen_WIDTH, UIScreen_HEIGHT-WhiteViewOne.frame.size.height-64) backgroundColor:HEXRGB(0xf1f5f4)];
    [self.view addSubview:ShopView];
    
    UIView* ShopUpView = [HuYuSealed createViewFrame:CGRectMake(0, 10, UIScreen_WIDTH, 202*HEIGHT) backgroundColor:[UIColor whiteColor]];
    [ShopView addSubview:ShopUpView];
    
    UIImageView* ShopUpImg = [HuYuSealed creatImageViewFrame:CGRectMake((UIScreen_WIDTH-80*WIDTH)/2, 25*HEIGHT, 80*WIDTH, 80*WIDTH) image:[UIImage imageNamed:@"实名认证"]];
    [ShopUpView addSubview:ShopUpImg];
    
    UILabel* ShopUpLab =[HuYuSealed CreatLabelWithFrame:CGRectMake(0,HEIGHT*25+ShopUpImg.frame.size.height+16*HEIGHT, UIScreen_WIDTH, 15*HEIGHT) text:@"上传商铺营业执照照片" textColor:[UIColor blackColor] font:15*HEIGHT];
    ShopUpLab.textAlignment = NSTextAlignmentCenter;
    [ShopUpView addSubview:ShopUpLab];
    
    UILabel* ShopUpLabTow =[HuYuSealed CreatLabelWithFrame:CGRectMake(0,HEIGHT*25+ShopUpImg.frame.size.height+16*HEIGHT*2+ShopUpLab.frame.size.height, UIScreen_WIDTH, 15*HEIGHT) text:@"需要文字清晰，边框完整" textColor:[UIColor blackColor] font:15*HEIGHT];
    ShopUpLabTow.textAlignment = NSTextAlignmentCenter;
    [ShopUpView addSubview:ShopUpLabTow];
    
    UIView* ShopFiledView = [HuYuSealed createViewFrame:CGRectMake(0,20+ShopUpView.frame.size.height, UIScreen_WIDTH, 152*HEIGHT) backgroundColor:[UIColor whiteColor]];
    [ShopView addSubview:ShopFiledView];
    
    
    for (int i =0; i<4; i++) {
        
        UIView* ShopLineView = [HuYuSealed createViewFrame:CGRectMake(10*WIDTH,ShopFiledView.frame.size.height/3*(i+1), UIScreen_WIDTH-10*WIDTH, 0.5) backgroundColor:HEXRGB(0xcccccc)];
        [ShopFiledView addSubview:ShopLineView];
    }
    
    NSArray* arr = @[@"许可证名称",@"许可证注册号",@"法人姓名"];
    for (int i =0; i<arr.count; i++) {
        
        UILabel* LineLab = [HuYuSealed CreatLabelWithFrame:CGRectMake(10*WIDTH, ShopFiledView.frame.size.height/9+ShopFiledView.frame.size.height/3*i, 100*WIDTH, ShopFiledView.frame.size.height/9) text:arr[i] textColor:[UIColor blackColor] font:15*HEIGHT];
        
        [ShopFiledView addSubview:LineLab];
        
    }
    
    XuKeNameFiled = [HuYuSealed CReateTextFieldFrame:CGRectMake(130*WIDTH, 0, UIScreen_WIDTH-100*WIDTH-10, 50*HEIGHT) placeholder:@"请输入许可证名称" pColor:[UIColor blackColor] font:15*HEIGHT clearButtonMode:UITextFieldViewModeNever];
    [ShopFiledView addSubview:XuKeNameFiled];
    
    XuKeHaoFiled = [HuYuSealed CReateTextFieldFrame:CGRectMake(130*WIDTH, 52*HEIGHT, UIScreen_WIDTH-100*WIDTH-10,50*HEIGHT) placeholder:@"请输入许可证证注册号" pColor:[UIColor blackColor] font:15*HEIGHT clearButtonMode:UITextFieldViewModeAlways];
    [ShopFiledView addSubview:XuKeHaoFiled];
    
    XuKePerFiled = [HuYuSealed CReateTextFieldFrame:CGRectMake(130*WIDTH,102*HEIGHT, UIScreen_WIDTH-100*WIDTH-10,50*HEIGHT) placeholder:@"请输入法人姓名" pColor:[UIColor blackColor] font:15*HEIGHT clearButtonMode:UITextFieldViewModeAlways];
    [ShopFiledView addSubview:XuKePerFiled];
    
    UIImageView* ShopGouImg = [HuYuSealed creatImageViewFrame:CGRectMake(10*WIDTH, 20+ShopUpView.frame.size.height+152*HEIGHT+70*HEIGHT,16*WIDTH, 16*WIDTH) image:[UIImage imageNamed:@"实名认证-个人2017-07-18_18"]];
    [ShopView addSubview:ShopGouImg];
    
    UILabel* PinTaiLabShop = [HuYuSealed CreatLabelWithFrame:CGRectMake(10*WIDTH+ShopGouImg.frame.size.width+5, 20+ShopUpView.frame.size.height+152*HEIGHT+68*HEIGHT,UIScreen_WIDTH-(10*WIDTH+ShopGouImg.frame.size.width+5+10*WIDTH),30*HEIGHT) text:@"平台有责任对商家信息进行隐私保护，仅当商家对用户家庭财产安全造成影响时，方可使用以上信息追溯商家法律责任" textColor:[UIColor blackColor] font:12*HEIGHT];
    PinTaiLabShop.numberOfLines = 0;
    PinTaiLabShop.lineBreakMode = NSLineBreakByWordWrapping;
    [ShopView addSubview:PinTaiLabShop];
    
    ShopShenHeBut = [HuYuSealed CREeatButtonWithFrame:CGRectMake(10*WIDTH, ShopView.frame.size.height-50-45*HEIGHT, UIScreen_WIDTH-20*WIDTH, 45*HEIGHT) target:self sel:@selector(ShopShenHeBut) title:@"提交审核" titleColor:[UIColor whiteColor] backGroundColor:HEXRGB(0xcccccc) font:20*HEIGHT layer:YES cornerRadius:5*HEIGHT];
    [ShopView addSubview:ShopShenHeBut];
    
    
    UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 20+ShopUpView.frame.size.height+152*HEIGHT+1*HEIGHT, UIScreen_WIDTH, 50*HEIGHT)];
    view1.backgroundColor = [UIColor whiteColor];
    [ShopView addSubview:view1];
//    UIView* ShopLineView2 = [HuYuSealed createViewFrame:CGRectMake(10*WIDTH,ShopFiledView.frame.size.height/3, UIScreen_WIDTH-10*WIDTH, 0.5) backgroundColor:HEXRGB(0xcccccc)];
//    [view1 addSubview:ShopLineView2];
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 15*HEIGHT, 100*WIDTH, 20*HEIGHT)];
    label.text = @"店铺行业";
    label.font = [UIFont systemFontOfSize:15];
    [view1 addSubview:label];
    pick = [[UIButton alloc]initWithFrame:CGRectMake(150*WIDTH, 0, UIScreen_WIDTH-160*WIDTH, 50*HEIGHT)];
    [pick addTarget:self action:@selector(clickPick) forControlEvents:UIControlEventTouchUpInside];
    [view1 addSubview:pick];
    UIImageView *more = [[UIImageView alloc]initWithFrame:CGRectMake( UIScreen_WIDTH-190*WIDTH,15*HEIGHT , 20*WIDTH, 20*WIDTH)];
    more.image = [UIImage imageNamed:@"更多"];
    [pick addSubview:more];
    
}
-(void)clickPick{
    PickViewController *pick2 = [[PickViewController alloc]init];
    [self.navigationController pushViewController:pick2 animated:YES];
}

#pragma mark 商家审核
-(void)ShopBut
{
    PerSonView.hidden = YES;
    ShopView.hidden = NO;
    [PerSonBut setImage:[UIImage imageNamed:@"实名认证-商铺2017-07-18_06"] forState:UIControlStateNormal];
    PerSonLab.textColor = [UIColor blackColor];
    
    [ShopBut setImage:[UIImage imageNamed:@"实名认证-商铺2017-07-18_03"] forState:UIControlStateNormal];
    ShopLab.textColor = HEXRGB(0x3cb83a);
    NSLog(@"商家审核");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
